<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <title>考核数据录入</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="/css/officialDocument/officialDocument.css">

    <link rel="stylesheet" href="/lib/layer/skin/default/layer.css">
    <link type="text/css" rel="stylesheet" href="/lib/pagination/style/pagination.css">
    <link rel="stylesheet" href="/css/base/base.css?20201106.1">

    <link rel="stylesheet" type="text/css" href="/lib/layui/layui/css/layui.css"/>
    <script type="text/javascript" src="/lib/layui/layui/layui.js"></script>
    <script type="text/javascript" src="/lib/layui/layui/layui.all.js"></script>
    <script type="text/javascript" src="/lib/layui/layui/global.js"></script>

    <script src="/js/common/language.js"></script>

    <script type="text/javascript" src="/js/jquery/jquery-1.9.1.js"></script>
    <script src="/js/jquery/jquery.cookie.js"></script>
    <script type="text/javascript" src="/js/base/tablePage.js"></script>
    <script src="/lib/layer/layer.js?20201106"></script>
    <script src="/js/base/base.js"></script>
    <script src="/lib/laydate/laydate.js"></script>
    <script type="text/javascript" charset="utf-8" src="/lib/pagination/js/jquery.pagination.min.js"></script>

    <%--<script src="/js/document/makeADraft.js"></script>--%>
    <link rel="stylesheet" type="text/css" href="/css/commonTheme/${sessionScope.InterfaceModel}/commonTheme.css"/>
    <style>

        body{
            overflow: hidden;
        }
        table tr {
            border-width: 1px;
            border-style: solid;
            border-color: rgb(204, 204, 204);
            border-image: initial;
        }
        table tr th {
            font-size: 17px;
            color: rgb(47, 92, 143);
            text-align: center;
            height: 28px;
            line-height: 28px;
        }

        table  td {
            font-size: 11pt;
            height: 30px;
            line-height: 30px;
            text-align: center;
            word-break: keep-all;
            white-space: nowrap;
            text-overflow: ellipsis;
            overflow: hidden;
        }
        table tr:nth-child(2n) {
            background-color: rgb(255, 255, 255);
        }
        table tr:nth-child(2n+1) {
            background-color:#F6F7F9 ;
        }
        .newLeave {
            border-radius: 3px;
            float: left;
            width: 70px;
            height: 28px;
            color: #fff;
            font-size: 14px;
            line-height: 28px;
            margin-left: 155px;
            margin-top: 14px;
            cursor: pointer;
            background: #2b7fe0
        }
        .clearfix {
            margin: 5px auto;
            width: 93%;
        }
        textarea.BigStatic {
            font-size: 10pt;
            padding: 1px 5px;
            border: 1px solid #C0BBB4;
            background: #E0E0E0;
            margin-left: 32px;
        }
        .index-desc{
            height: 95px;
            float: left;
            line-height: 95px;
            margin-right: 9px;
        }
        .lab-set{
            height: 50px;
            float: left;
            line-height: 47px;

        }
        #portalName{
            height: 30px;
            margin-right: 16px;
        }
        .li-set p{
            margin: 5px 0 0 103px;
        }
        .M-box3 .active {
            margin: 0px 3px;
            width: 38px;
            height: 38px;
            line-height: 38px;
            background: #2b7fe0;
            font-size: 12px;
            border: 1px solid #2b7fe0;
            color: #fff;
            text-align: center;
            display: inline-block;
        }
        .M-box3 {
            margin-top: 30px;
            position: fixed;
            bottom: 10px;
            right: 60px;
            text-align: center;
        }
        .M-box3 a {
            margin: 0 3px;
            width: 38px;
            height: 38px;
            line-height: 38px;
            font-size: 12px;
            display: inline-block;
            text-align: center;
            background: #fff;
            border: 1px solid #ebebeb;
            color: #333;
            text-decoration: none;
        }
        .jump-ipt {
            width: 38px;
            height: 38px;
            line-height: 38px;
            text-align: center;
            padding: 0;
        }
        #kaoList{
            margin:50px 0 0 30px;
            float:left;
            width: 130px;
        }
        #kaoList dt{
            font-size: 14px;
            height: 30px;
            line-height: 30px;
            text-align: center;
        }
        #kaoList dd{
            font-size: 13px;
            height: 26px;
            line-height: 26px;
            text-align: center;
            background-color: rgb(217, 232, 255);
        }
        #kaoList dd a{
            color: #007cfd;
        }
        #kaoheList{
            margin: 80px 0 0 20%;
            float: left;
            width: 400px;
            color: #fff;
            height: 300px;
        }
        #kaoheList p{
            font-size: 14px;
            height: 30px;
            line-height: 30px;
            background-color: #357ece;
            padding-left: 28px;
            /* margin-top: 0px; */
            position: absolute;
            width: 372px;
            border-radius: 10px 10px 0 0;
        }
        #kaoheList .info{
            background: #357ece  url("../img/sys/icon64_info.png") no-repeat 48px 36px;
            height: 134px;
            text-align: center;
            line-height: 40px;
            border-radius: 10px;
            box-shadow: 3px 3px 3px #2F5C8F;

        }
        .self_input{
            height:26px;
        }
        table tr td a {
            color: #2b7fe0;
            width: 100%;
            display: block;
        }
        #footContent{
            width: 600px;
            height:30px;
            text-align: center;
            margin-top: 10px;
            padding-left: 30px;
        }
        #footContent a{
            color: #fff;
            text-align: center;
            display: inline-block;
            height: 24px;
            width: 70px;
            line-height: 24px;
            background-color:#2b7fe0;
            border-radius: 5px;
            padding: 5px;

        }
        .headTop{
            position: inherit;
        }
        .on{
            background: #D3E7FA !important;
        }
        .explain{
            width: 32%;
            margin: 4px 10px;
        }
        .explain td{
            padding: 0;
            border: 1px solid #cccccc;
        }
        .explainleft{
            float: left;
            border: none!important;
            margin-left: 6px;
        }
        .list1 tr th{
            border: 1px solid #cccccc;
        }
        .savebtn,.back,.sub{
            border-color: #4898d5;
            background-color: #2e8ded;
            color: #fff;
            padding: 5px 15px;
            border-radius: 3px;
        }
        .layui-input-block{
            margin-left: 0px;
        }
        .trTask td{
            overflow: visible;
        }
        #taskBody .trTask  td{
            border: 1px solid #cccccc;
        }
        body{
            overflow-y: auto;
        }
    </style>
</head>
<body>
<div class="headTop" id="maintop">
    <div class="headImg">
        <img src="/img/jinxingkaohe.png" alt="">
    </div>
    <div class="divTitle">
        考核数据录入
    </div>
</div>
<h1 style="text-align: center;font-weight: 500;margin: 5px 0" class="flow_title"></h1>
<h2 style="text-align: center;font-weight: 500;margin-top:14px" class="title1"></h2>
<p style="font-size: 14px;margin: 10px 10px">评价尺度说明:</p>
<table class="explain" style="float: left;">
    <tr>
        <td style="width: 28%">分值</td>
        <td style="text-align: center">说明</td>
    </tr>
    <tr>
        <td>优(90-100)</td>
        <td class="explainleft">非常称职甚至超越岗位期望。</td>
    </tr>
    <tr>
        <td>良(80-89)</td>
        <td class="explainleft">称职，能较好达到岗位期望。</td>
    </tr>
    <tr>
        <td>中(70-79)</td>
        <td class="explainleft">称职，能达到岗位期望。</td>
    </tr>
    <tr>
        <td>合格(60-69)</td>
        <td class="explainleft">基本称职，即基本达到岗位期望。</td>
    </tr>
    <tr>
        <td>待改善(60以下)</td>
        <td class="explainleft">不能满足岗位需求。</td>
    </tr>
</table>
<p style="font-size: 14px;margin-top: -30px;margin-left: 34%;">考核规则：</p>
<table style="float: left;text-align: left;width: 600px;margin: 4px 10px;" >
    <tr><td class="explainleft">1、考核成绩在同圈层人员之间采用“2-3-4-1”排序，分为A、B、C、D四级。</td></tr>
    <tr><td class="explainleft">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;A级：同圈层考核成绩排名在前20%名；</td></tr>
    <tr><td class="explainleft">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;B级：同圈层考核成绩排名在前20%到50%；</td></tr>
    <tr><td class="explainleft">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C级：同圈层考核成绩排名在50%到90%；</td></tr>
    <tr><td class="explainleft">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;D级：同圈层排名在后10%。</td></tr>
    <tr><td class="explainleft">2、各级配比要求为：A级≤20%、B级≤30%，C级≤40%，D级≥10%（四舍五入排序）。</td></tr>
</table>
<table style="margin-left: 10px;margin-top:50px;width: 98%" id="taskBody1">
    <thead class="list1">
    </thead>
    <tbody id="taskBody">
    </tbody>


</table>
<div class="btn_div" style="text-align:center;margin: 10px auto">
    <button class="savebtn">保存</button>
    <button class="sub">提交</button>
    <button class="back">返回</button>
</div>
<script>
    function getQueryString(name){
        var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if(r!=null)return  unescape(r[2]); return null;
    }
    var title1;
    var flowId = getQueryString("flowId");
    var type = getQueryString("type");
    if(type=='2'){
        $('.savebtn').hide();
        $('.sub').hide();
    }
    $.ajax({
        type: 'post',
        url: '/ScoreFlowController/selScoreFlow',
        dataType: 'json',
        data: {
            flowId:flowId
        },
        success: function (res) {
            if(res.flag){
                var obj = res.obj[0];
                if(obj.flowFlag=='2'||obj.flowFlag=='3'){
                    $('.savebtn').hide();
                    $('.sub').hide();
                }
                $('.flow_title').text(obj.flowTitle);
            }else{
                $('.savebtn').hide();
                $('.sub').hide();
                $('.flow_title').hide();
            }
        }
    })
    $.ajax({
        type:'get',
        url:'/ScoreFlowController/selPaperDetail',
        dataType:'json',
        data:{
            flowId:flowId,
            groupType:'1'
        },
        success:function(res){
            title1=res.data.groupName;
            $(".title1").text(title1)
            if(res){
                var str11 = "";
                var str22 = "";
                var str33 = "";
                var avv = "";
                var readOnlyStr = '';
                if(type=='2'){
                    readOnlyStr = 'readOnly="true"';
                }
                // 遍历生成空表格
                for(var i=0;i<res.data.groupTypes.length;i++){
                    var str1 = "";
                    var str2 = "";
                    var str3 = "";
                    if(res.data.groupTypes[i].scoreItems.length == 0){
                        str1+='<th></th>'
                        str2+='<th></th>'
                        str3='<th>'+res.data.groupTypes[i].groupName+'<br/>'+res.data.groupTypes[i].weight*100+'%'+'</th>'
                    }else{
                        for(var j=0;j<res.data.groupTypes[i].scoreItems.length;j++){
                            str1+='<th id="item'+res.data.groupTypes[i].scoreItems[j].itemId+'" class="item_name" desc="'+res.data.groupTypes[i].scoreItems[j].itemExplain+'"><span class="abc" style="display: none">'+res.data.groupTypes[i].scoreItems[j].itemId+'</span>'+res.data.groupTypes[i].scoreItems[j].itemName+'</th>'
                            str2+='<th>'+res.data.groupTypes[i].scoreItems[j].weight*100+'%'+'</th>'
                            if(j==0){
                                str3='<th colspan='+res.data.groupTypes[i].scoreItems.length+'>'+res.data.groupTypes[i].groupName+'<br/>'+res.data.groupTypes[i].weight*100+'%'+'</th>'
                            }else{
                                str3+='<th style="display: none" title="'+res.data.groupTypes[i].scoreItems[j].itemExplain+'"><span class="abc" style="display: none">'+res.data.groupTypes[i].scoreItems[j].itemId+'</span>'+res.data.groupTypes[i].scoreItems[j].itemName+'</th>'

                            }
                            avv +=
                                '<td>' +
                                '<input name="scoretotal" groupwidth="'+res.data.groupTypes[i].weight+'" itemwidth="'+res.data.groupTypes[i].scoreItems[j].weight+'"  class="scoretotal" value="100" '+readOnlyStr+' style="border:none;background-color:none;width: 100%;height: 36px" type="number" oninput="numInput($(this))" onblur="numonb($(this))" onfocus="numonf($(this))" />'
                                '</td>+'
                        }
                    }
                    str11 += str1;
                    str22 += str2;
                    str33 += str3;
                }
                var s = '<tr><th rowspan="3" style="width: 42px">ID</th><th rowspan="2" colspan="5" style="width: 360px">评测对象</th>'+str33+'<th rowspan="3" style="width: 84px">总分</th></tr>' +
                        '<tr><th style="display: none;width: 42px">ID</th><th style="display: none;width: 84px">评测对象</th>'+str11+'</tr>' +
                        '<tr><th style="display: none;width: 42px">ID</th><th>姓名</th><th>部门</th><th>职务</th><th>考核角色</th><th>考核权重</th>'+str22+'</tr>';
                $('.list1').html(s)

                var acc = "";
                var avv1='<td>'+'<input name="scoreNum" value="100" disabled="disabled" '+readOnlyStr+' style="border:none;background-color:none;width: 100%;height: 36px" type="number" />' +
                    '</td>'
                for(var q=0;q<res.data.scoreFlowUsers.length;q++) {
                    var tdstyle= 'overflow: hidden;';
                    if(res.data.scoreFlowUsers[q].status!=0){
                        tdstyle += 'color:red;'
                    }
                    acc += '<tr status="'+res.data.scoreFlowUsers[q].status+'" class="trTask">' +
                        '<td style="'+tdstyle+'">' + res.data.scoreFlowUsers[q].ids + '</td>'+
                        '<td style="'+tdstyle+'">' + res.data.scoreFlowUsers[q].userName + '</td>'+
                            '<td style="'+tdstyle+'" title="'+res.data.scoreFlowUsers[q].deptName+'">' + res.data.scoreFlowUsers[q].deptName + '</td>'+
                            '<td style="'+tdstyle+'" title="'+res.data.scoreFlowUsers[q].postName+'">' + res.data.scoreFlowUsers[q].postName + '</td>'+
                        '<td style="'+tdstyle+'">' + res.data.scoreFlowUsers[q].privTypNames + '</td>'+
                        '<td style="'+tdstyle+'">' + res.data.scoreFlowUsers[q].assessorWeights + '</td>'+
                        avv+ avv1 + '</tr>'
                }

                $('#taskBody').html(acc);

                var dataarr = []
                var dataarr1 = []
                for(var q=0;q<res.data.scoreFlowUsers.length;q++) {
                    dataarr1.push(toFixed2(res.data.scoreFlowUsers[q].score));
                    //console.log(dataarr1);
                    if(res.data.scoreFlowUsers[q].scoreFlowItems.length>0){
                        for (var q5 = 0; q5 < res.data.scoreFlowUsers[q].scoreFlowItems.length; q5++) {
                            dataarr.push(res.data.scoreFlowUsers[q].scoreFlowItems[q5].grade);    ///111
                        }
                    }
                }

                // 遍历赋值
                for(var m = 0;m<dataarr.length;m++){
                    var mineSelparentTyepNo = $("#taskBody tr td").find("input[name=scoretotal]");
                    $.each(mineSelparentTyepNo, function (index, item) {
                        if (index == m) $(item).attr('value', dataarr[m]);
                    });

                }


                $('.trTask').each(function(){
                    var totalNum = 0;
                    var $scoretotals = $(this).find('input[name=scoretotal]');
                    $scoretotals.each(function(){
                        totalNum += $(this).val()*$(this).attr("groupwidth")*$(this).attr("itemwidth");
                    })
                    var mineScoreumo = $(this).find("input[name=scoreNum]");
                    mineScoreumo.attr('value', toFixed2(totalNum));
                    var status = $(this).attr('status');
                    if(status!='0'){
                        $(this).find('input').attr('disabled',true)
                    }
                })

                //动态更新总分
                $(".scoretotal").change(function(){
                    var totalNum = 0;
                    var $scoretotals =  $(this).parent().parent().find('input[name=scoretotal]');
                    $scoretotals.each(function(){
                        totalNum += $(this).val()*$(this).attr("groupwidth")*$(this).attr("itemwidth");
                    })
                    var mineScoreumo = $(this).parent().parent().find("input[name=scoreNum]");
                    mineScoreumo.attr('value', toFixed2(totalNum));
                })

            }else{
                layer.msg("暂无数据", {icon: 2})
            }
        }
    })
    // 保存
    $('.savebtn').click(function () {
        var $tbod = $("#taskBody").find("tr");
        var arr = [];
        var tyuu="";
        //获取测试的具体项目
        var $category = $(".list1").find("tr").eq(1).find("th span.abc");
        var first=[];
        var first1="";
        for(var y=0;y<$category.length;y++){
            first.push($category[y].innerText)
        }
        var abcc=$("#taskBody tr td").find("input[name=scoretotal]")
        var qw='';
        var qw1=[];
        for(var j=0;j<abcc.length;j++){
            qw+=abcc[j].value+'|';  
            qw1.push(abcc[j].value)
        }

        //总的数组
        var xcc=group(qw1,first.length)

        // 判断总分不能相同
        var $scoreNum = $('input[name="scoreNum"]');
        if ($scoreNum.length > 1) {
            var flag = true;
            for (var i = 0; i < $scoreNum.length - 1; i++) {
                if ($scoreNum.eq(i).val() == $scoreNum.eq(i + 1).val()) {
                    flag = false;
                    break;
                }
            }
            if (!flag) {
                layer.msg("总分中存在重复分数，请核实修改再次保存或提交",{icon:2});
                return false;
            }
        }
        
        // 遍历判断重复
        // for(var m=0;m<xcc.length;m++){
        //     // 遍历判断是否有重复的数字
        //     var sameFlag = true;
        //     for(var i = 0; i < xcc[m].length; i++) {
        //         if(xcc[m][0] != xcc[m][i]) {
        //             sameFlag = false;
        //             break;
        //         }
        //     }
        //
        //     if(sameFlag){
        //         layer.msg("保存分数有全部相同分数，请重新输入",{icon:2});
        //         return;
        //     }
        //
        // }

        var total2=new Array();
        var aaa=[]
        for(var x=0;x<xcc.length;x++){
            for(var h=0;h<first.length&&h<qw1.length;h++){
                total2.push([first[h]+"_"+xcc[x][h]]+'|')
            }
        }
        var xccc=group(total2,first.length)
        var sarr=[];
        for(var o=0;o<xccc.length;o++){
            var total3="";
            for(var c=0;c<xccc[o].length;c++){
                total3+=xccc[o][c]
            }
            sarr.push(total3);
        }
        for(var i=0;i<$tbod.length;i++){
            var $trb = $("#taskBody").find("tr").eq(i).find("td");
            var str = "";
            str = $($trb).eq(0).text()+"*"+sarr[i]+'|'
            str=str.substring(0, str.lastIndexOf('||'));
            arr.push(str);
        }
        var qw2="";
        for(var z=0;z<arr.length;z++){
            qw2+= arr[z]+','
        }
        $.ajax({
            url: '/ScoreFlowController/setFlowItem',
            type: 'post',
            data: {
                flowId: flowId,
                userScores:qw2
            },
            dataType: 'json',
            success: function (res) {
                if(res.code==0){
                    layer.msg("保存成功", {
                        icon: 1,
                        time: 1500 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {
                        location.href = "/ScoreGroupController/score?flowId="+flowId
                    });
                }else{
                    layer.msg("保存失败",{icon:2});
                    return false;
                }


            }
        })

    })
    // 提交
    $('.sub').click(function () {
        var $tbod = $("#taskBody").find("tr");
        var arr = [];
        var tyuu="";
        //获取测试的具体项目
        var $category = $(".list1").find("tr").eq(1).find("th span.abc");
        var first=[];
        var first1="";
        for(var y=0;y<$category.length;y++){
            first.push($category[y].innerText)
        }
        var abcc=$("#taskBody tr td").find("input[name=scoretotal]")
        var qw='';
        var qw1=[];
        for(var j=0;j<abcc.length;j++){
            qw+=abcc[j].value+'|';
            qw1.push(abcc[j].value)
        }
        
        // 判断总分不能相同
        var $scoreNum = $('input[name="scoreNum"]');
        if ($scoreNum.length > 1) {
            var flag = true;
            for (var i = 0; i < $scoreNum.length - 1; i++) {
                if ($scoreNum.eq(i).val() == $scoreNum.eq(i + 1).val()) {
                    flag = false;
                    break;
                }
            }
            if (!flag) {
                layer.msg("总分中存在重复分数，请核实修改再次保存或提交",{icon:2});
                return false;
            }
        }
        
        //总的数组
        var xcc=group(qw1,first.length)
        // 遍历判断重复
        // for(var m=0;m<xcc.length;m++){
        //     // 遍历判断是否有重复的数字
        //     var sameFlag = true;
        //     for(var i = 0; i < xcc[m].length; i++) {
        //         if(xcc[m][0] != xcc[m][i]) {
        //             sameFlag = false;
        //         }
        //     }
        //
        //     if(sameFlag){
        //         layer.msg("保存分数有全部相同分数，请重新输入",{icon:2});
        //         return;
        //     }
        //
        // }

        var total2=new Array();
        var aaa=[]
        for(var x=0;x<xcc.length;x++){
            for(var h=0;h<first.length&&h<qw1.length;h++){
                total2.push([first[h]+"_"+xcc[x][h]]+'|')
            }
        }
        var xccc=group(total2,first.length)
        var sarr=[];
        for(var o=0;o<xccc.length;o++){
            var total3="";
            for(var c=0;c<xccc[o].length;c++){
                total3+=xccc[o][c]
            }
            sarr.push(total3);
        }
        for(var i=0;i<$tbod.length;i++){
            var $trb = $("#taskBody").find("tr").eq(i).find("td");
            var str = "";
            str = $($trb).eq(0).text()+"*"+sarr[i]+'|'
            str=str.substring(0, str.lastIndexOf('||'));
            arr.push(str);
        }
        var qw2="";
        for(var z=0;z<arr.length;z++){
            qw2+= arr[z]+','
        }

        $.ajax({
            url: '/ScoreFlowController/setFlowItem',
            type: 'post',
            data: {
                flowId: flowId,
                userScores:qw2,
                status:1
            },
            dataType: 'json',
            success: function (res) {
                if(res.code==0){
                    layer.msg("提交成功", {
                        icon: 1,
                        time: 1500 //2秒关闭（如果不配置，默认是3秒）
                    }, function () {
                        location.href = "/ScoreGroupController/score?flowId="+flowId
                    });
                }else{
                    layer.msg("提交失败", {
                        icon: 2,
                        time: 1500 //2秒关闭（如果不配置，默认是3秒）
                    });
                    return false;
                }


            }
        })

    })
    //  返回
    $(document).on('click', '.back', function () {
        location.href="/ScoreGroupController/score?type="+getQueryString("type")
    })
    //  提交
    $(document).on('click', '.cancel', function () {
        location.href="/ScoreGroupController/score?type="+getQueryString("type")
    })
    function fun(){
        //获取被选中的option标签
        var vs = $("#taskBody tr td").find("select option:selected").val()
    }
    
    var layerTipIndex = null;
    $(document).on('mouseover', '.item_name', function(){
        var id = $(this).attr('id');
        var text = $(this).attr('desc');
        layerTipIndex = layer.tips(text, '#' + id, {
            tips: [1, '#2f5c8f'],
            time: 0
        });
    });

    $(document).on('mouseout', '.item_name', function () {
        layer.close(layerTipIndex);
    });

    //处理空值
    function undefindData(data) {
        if(data == undefined){
            return '';
        }else{
            return data;
        }
    }
    // 处理数字限制
    function numInput(e){
        var value = e.val();

        if(value<0){
            e.val(0);
            return ;
        }

        if(value>100){
            e.val(100);
            return ;
        }
        if(value.length>3){
            value=value.slice(0,3);
            e.val(value);
            return ;
        }
        if(value.length>=2&&value.slice(0,1)==0){
            value = value.slice(1,value.length)
            e.val(value);
            return ;
        }

    }
    // 鼠标点击进入事件
    function numonf(e){
        if(type!=2){
            var value = e.val();
            if(value==100){
                e.val('');
                return ;
            }
        }
    }
    // 鼠标离开事件
    function numonb(e){
        if(type!=2){
            var value = e.val();
            if(value==''||value<0){
                e.val(100);
                return ;
            }
        }
    }

    // 保留两位小数
    function toFixed2(num){
        if(num==undefined){
            return 0;
        }else{
            return Number(num.toFixed(2));
        }
    }
    function group(array, subGroupLength) {
        var index = 0;
        var newArray = [];
        while(index < array.length) {
            newArray.push(array.slice(index, index += subGroupLength));
        }
        return newArray;
    }
    layui.use(['table','form'], function(){
        var table = layui.table;
        var form = layui.form;
        form.render()
    })
</script>
</body>
</html>
